<template>
  <div>
    <input v-model="inputValue" type="number" />
    <div>
      <label>反馈结果</label>
      <div>
        {{ answer }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  watch: {
    // 我要监听inputValue属性,看看用户究竟输入了啥
    inputValue(newValue) {
      newValue = Number(newValue);
      if (newValue === 0) {
        this.answer = "喔，你打错啦";
      } else if (newValue === 1) {
        this.answer = "你拍一我拍一";
      } else if (newValue > 2) {
        this.answer = "这么牛，要上天吗";
      }
    },
  },
  data() {
    return {
      // 定义一个数据
      inputValue: "",
      answer: "",
    };
  },
};
</script>
